﻿using MediatR;
using S.EarTag.API.Mediator.MediatorCommand.AppearanceCommand;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Mediator.MediatorCommandHandler.AppearanceCommandHandler
{
    public class AppearanceDeleteCommandHandler : IRequestHandler<AppearanceDeleteCommand, bool>
    {
        private readonly IAppearanceModelRepository _appearanceModelRepository;
        public AppearanceDeleteCommandHandler(IAppearanceModelRepository appearanceModelRepository)
        {
            _appearanceModelRepository= appearanceModelRepository;
        }
        /// <summary>
        /// 根据主键id删除品相测量数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<bool> Handle(AppearanceDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _appearanceModelRepository.DeleteAsync(request.AppearanceId);
        }
    }
}
